cmake_minimum_required(VERSION 3.24)

project(yolov8_bytetrack LANGUAGES CXX CUDA)

add_definitions(-DAPI_EXPORTS)
set(CMAKE_CXX_STANDARD 17)

include_directories("C:/Program Files/Eigen3/include/eigen3/")
# include and link dirs of cuda and tensorrt, you need adapt them if yours are different
# ============= cuda ============
include_directories("C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.8/include/")

# ============ opencv ============
set(OpenCV_DIR D:/Tool/opencv/build/x64/vc15/lib)
set(OpenCV_INCLUDE_DIRS D:/Tool/opencv/build/include)
find_package(OpenCV)
include_directories(${OpenCV_INCLUDE_DIRS})

# =========== bytetrack lib ===========
include_directories(${PROJECT_SOURCE_DIR}/bytetrack/include)
file(GLOB_RECURSE SRCS01 ${PROJECT_SOURCE_DIR}/bytetrack/src/*.cpp)
add_library(bytetrack SHARED ${SRCS01})
target_link_libraries(bytetrack ${OpenCV_LIBS})

# ============= yolov8 lib =============
include_directories(${PROJECT_SOURCE_DIR}/yolo/include)
include_directories(${PROJECT_SOURCE_DIR}/yolo/plugin)
file(GLOB_RECURSE SRCS02 ${PROJECT_SOURCE_DIR}/yolo/src/*.cpp ${PROJECT_SOURCE_DIR}/yolo/src/*.cu ${PROJECT_SOURCE_DIR}/yolo/plugin/*.cu)
add_library(yolo_infer SHARED ${SRCS02})
target_link_libraries(yolo_infer nvinfer cudart ${OpenCV_LIBS})

# ======== main execute file ========
add_executable(main ${PROJECT_SOURCE_DIR}/main.cpp)
target_link_libraries(main bytetrack yolo_infer)
